package me.luger.project.fof.service;

import me.luger.core.dao.nutz.service.BaseService;
import me.luger.project.fof.entity.AdminUser;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.springframework.stereotype.Repository;

@Repository
public class AdminUserService extends BaseService<AdminUser> {
    public AdminUserService(Dao dao) {
        super(dao);
    }

    /**
     * 登录操作
     * @param userName
     * @param password
     * @return
     * adminUser:login sucess return adminUser's id
     * null :userName and password not match
     */
    public AdminUser login(String userName,String password){
        AdminUser adminUser = this.fetchOne(Cnd.where("userName","=",userName).and("password","=",password));
        if(null != adminUser){
            return adminUser;
        }
        return null;
    }
}
